#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import requests
import json

def test_simple_generate():
    """测试简单的生成预案请求"""
    print("🔄 测试简单的生成预案请求...")
    
    # 最简单的测试数据
    data = {
        "event_type": "test",
        "event_subtype": "test",
        "optimize_field": "",
        "optimize_suggest": "",
        "history": []
    }
    
    try:
        response = requests.post(
            'http://localhost:8080/api/v1/generate_plan',
            json=data,
            headers={'Content-Type': 'application/json'},
            timeout=30
        )
        
        print(f"状态码: {response.status_code}")
        print(f"响应头: {dict(response.headers)}")
        print(f"响应内容: {response.text}")
        
        if response.status_code == 200:
            result = response.json()
            print("✅ 生成预案成功！")
            return True
        else:
            print("❌ 生成预案失败")
            return False
            
    except Exception as e:
        print(f"❌ 请求异常: {e}")
        import traceback
        traceback.print_exc()
        return False

if __name__ == "__main__":
    test_simple_generate() 